package efuliBusiness.efuliApi;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import efuliBusiness.ebuyOpenPlatformUtil.OpenPlatformHttp;


/**
 * Created by yangxianming on 2018/5/24.
 */
public class Welfarepoint {
    private OpenPlatformHttp openPlatformHttp = new OpenPlatformHttp();
    private String url;

    public Welfarepoint(String evn){
        JSONObject evnData = JSON.parseObject("{\"dev\":\"http://koufudev.e-fuli.com:8087/api/welfarepoint\"," +
                "\"sit\":\"https://efulisit.alipay-eco.com/api/welfarepoint\"," +
                "\"prod\":\"https://efuli.alipay-eco.com/api/welfarepoint\"}");
        this.url = evnData.getString(evn);
    }

    //创建企业
    public JSONObject efuli_welfarepoint_corp_create(JSONObject param){
        String s = openPlatformHttp.sendHttp(url, param, "efuli.welfarepoint.corp.create");
        return JSON.parseObject(s);
    }
    //创建会员/员工
    public JSONObject efuli_welfarepoint_member_create(JSONObject param){
        return JSON.parseObject(openPlatformHttp.sendHttp(url, param, "efuli.welfarepoint.member.create"));
    }
    //企业员工充值
    public JSONObject efuli_welfarepoint_recharge(JSONObject param){
        return JSON.parseObject(openPlatformHttp.sendHttp(url, param, "efuli.welfarepoint.recharge"));
    }
    //企业充值
    public JSONObject efuli_welfarepoint_corp_recharge(JSONObject param){
        return JSON.parseObject(openPlatformHttp.sendHttp(url, param, "efuli.welfarepoint.corp.recharge"));
    }
    //sql查询 efuli.data.query
    public JSONObject efuli_data_query(JSONObject param){
        String r = openPlatformHttp.sendHttp(url, param, "efuli.data.query");
        return JSON.parseObject(r);
    }
    //sql更新数据 efuli.data.update1 获取token
    public JSONObject efuli_data_update1(JSONObject param){
        return JSON.parseObject(openPlatformHttp.sendHttp(url, param, "efuli.data.update"));
    }
    //sql更新数据 efuli.data.update2 通过token查询
    public JSONObject efuli_data_update2(JSONObject param){
        return JSON.parseObject(openPlatformHttp.sendHttp(url, param, "efuli.data.update"));
    }

}
